<?php
class Model_Societe extends System_App_Model_Abstract{
	protected $table = 'societe';
	
	public static $structure = array(
		'id'=>array( 'type'=>'int', 'editable'=>'hidden' )
		,'societe_id'=>array( 'type'=>'int', 'editable'=>'hidden', 'label' => 'societe' )
		,'raison_sociale'=>array( 'type'=>'string', 'editable'=>'input', 'max' => 1024 )
		,'nom_commerciale'=>array( 'type'=>'string', 'editable'=>'input', 'max' => 1024 )
		,'siret'=>array( 'type'=>'int', 'editable'=>'input' )
		,'tva'=>array( 'type'=>'string', 'editable'=>'input', 'max' => 1024 )
		,'effectif'=>array( 'type'=>'int', 'editable'=>'input' )
		,'adresse1'=>array( 'type'=>'string', 'editable'=>'input', 'max'=>1024 )
		,'adresse2'=>array( 'type'=>'string', 'editable'=>'input', 'max'=>1024 )
		,'cp'=>array( 'type'=>'string', 'editable'=>'input', 'max'=>12 )
		,'ville'=>array( 'type'=>'string', 'editable'=>'input', 'max'=>512 )
		,'email'=>array( 'type'=>'mail', 'editable'=>'input' )
		,'telephone'=>array( 'type'=>'phone', 'editable'=>'input', 'max' => 20 )
		,'site'=>array( 'type'=>'string', 'editable'=>'input', 'max' => 255 )
		,'activite'=>array( 'type'=>'string', 'editable'=>'input', 'max' => 128 )
		,'notes'=>array( 'type'=>'string', 'editable'=>'textarea')
		,'date_crea'=>array( 'type'=>'datetime', 'editable'=>'none', 'label'=>'date de création')
		,'date_edit'=>array( 'type'=>'datetime', 'editable'=>'none', 'label'=>'dernière édition')
	);
	
	private $_id;
	private $_societe_id;
	private $_raison_sociale;
	private $_nom_commercial;
	private $_siret;
	private $_tva;
	private $_effectif;
	private $_adresse1;
	private $_adresse2;
	private $_cp;
	private $_ville;
	private $_site;
	private $_email;
	private $_activite;
	private $_telephone;
	private $_notes;
	private $_date_crea;
	private $_date_edit;
		
	/* getter */
	public function getId(){
		return $this->_id;
	}
	public function getSociete(){
		return new Model_Societe( $this->_societe_id );
	}
	public function getSocieteId(){
		return $this->_societe_id;
	}
	public function getRaisonSociale(){
		return $this->_raison_sociale;
	}
	public function getNomCommercial(){
		return $this->_nom_commercial;
	}
	public function getSiret(){
		return $this->_siret;
	}
	public function getTva(){
		return $this->_tva;
	}
	public function getEffectif(){
		return $this->_effectif;
	}
	public function getAdresse1(){
		return $this->_adresse1;
	}
	public function getAdresse2(){
		return $this->_adresse2;
	}
	public function getCp(){
		return $this->_cp;
	}
	public function getVille(){
		return $this->_ville;
	}
	public function getSite(){
		return $this->_site;
	}
	public function getEmail(){
		return $this->_email;
	}
	public function getTelephone(){
		return $this->_telephone;
	}
	public function getActivite(){
		return $this->_activite;
	}
	public function getNotes(){
		return $this->_notes;
	}
	public function getDateCrea(){
		return $this->_date_crea;
	}
	public function getDateEdit(){
		return $this->_date_edit;
	}
	
	/* setter */
	public function setId( $value ){
		$this->_id = $value;
	}
	public function setSociete( $value ){
		if( is_int($value) )$this->_societe_id = $value;
		else $this->_societe_id = $value->getId();
	}
	public function setSocieteId( $value ){
		$this->_societe_id = $value;
	}
	public function setRaisonSociale( $value ){
		$this->_raison_sociale = $value;
	}
	public function setNomCommercial( $value ){
		$this->_nom_commercial = $value;
	}
	public function setSiret( $value ){
		$this->_siret = $value;
	}
	public function setTva( $value ){
		$this->_tva = $value;
	}
	public function setEffectif( $value ){
		$this->_effectif = $value;
	}
	public function setAdresse1( $value ){
		$this->_adresse1 = $value;
	}
	public function setAdresse2( $value ){
		$this->_adresse2 = $value;
	}
	public function setCp( $value ){
		$this->_cp = $value;
	}
	public function setVille( $value ){
		$this->_ville = $value;
	}
	public function setSite( $value ){
		$this->_site = $value;
	}
	public function setEmail( $value ){
		$this->_email = $value;
	}
	public function setTelephone( $value ){
		$this->_telephone = $value;
	}
	public function setActivite( $value ){
		$this->_activite = $value;
	}
	public function setNotes( $value ){
		$this->_notes = $value;
	}	
	public function setDateCrea( $value ){
		$this->_date_crea = $value;
	}
	public function setDateEdit( $value ){
		$this->_date_edit = $value;
	}
}
?>